package com.bussiness.system.model;

import com.bussiness.system.dto.MyDeptPostsDto;

import java.util.Date;

public class MyDeptPostsEntity {
    private Long id;

    private String name;

    private Long pid;

    private String type;

    private String deptPostsStatus;

    private Date gmtCreate;

    private Date gmtModified;

    public MyDeptPostsEntity(Long id, String name, Long pid, String type, String deptPostsStatus, Date gmtCreate, Date gmtModified) {
        this.id = id;
        this.name = name;
        this.pid = pid;
        this.type = type;
        this.deptPostsStatus = deptPostsStatus;
        this.gmtCreate = gmtCreate;
        this.gmtModified = gmtModified;
    }

    public void updateEntity(MyDeptPostsEntity myDeptPostsEntity, MyDeptPostsDto myDeptPostsDto){
        myDeptPostsEntity.setId(Long.parseLong(myDeptPostsDto.getId()));
        myDeptPostsEntity.setName(myDeptPostsDto.getName());
        String pid = myDeptPostsDto.getPid();
        if(null!=pid&&!pid.isEmpty()){
            myDeptPostsEntity.setPid(Long.parseLong(myDeptPostsDto.getPid()));
        }

        myDeptPostsEntity.setType(myDeptPostsDto.getType());
        myDeptPostsEntity.setDeptPostsStatus(myDeptPostsDto.getDeptPostsStatus());
    }

    public MyDeptPostsEntity() {
        super();
    }

    public MyDeptPostsEntity(MyDeptPostsDto myDeptPostsDto){
        this.name = myDeptPostsDto.getName();
        this.pid = Long.parseLong(myDeptPostsDto.getPid());
        this.type = myDeptPostsDto.getType();
        this.deptPostsStatus = myDeptPostsDto.getDeptPostsStatus();
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name == null ? null : name.trim();
    }

    public Long getPid() {
        return pid;
    }

    public void setPid(Long pid) {
        this.pid = pid;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type == null ? null : type.trim();
    }

    public String getDeptPostsStatus() {
        return deptPostsStatus;
    }

    public void setDeptPostsStatus(String deptPostsStatus) {
        this.deptPostsStatus = deptPostsStatus == null ? null : deptPostsStatus.trim();
    }

    public Date getGmtCreate() {
        return gmtCreate;
    }

    public void setGmtCreate(Date gmtCreate) {
        this.gmtCreate = gmtCreate;
    }

    public Date getGmtModified() {
        return gmtModified;
    }

    public void setGmtModified(Date gmtModified) {
        this.gmtModified = gmtModified;
    }
}